<section class="banner-right-3">
	<a href="<?php echo $this->getUrl('contacts')?>" style="display: block; width: 200px; height: 152px;" title="Contacts us">
		<h4>Call us</h4>
		<h3>6285 0320</h3>
	</a>
</section>
<section class="banner-right-1" style="text-align: center;">
	<a href="<?php echo $this->getUrl('shipping-returns')?>" title="Shipping & Returns">
		<img width="210" src="<?php echo $this->getSkinUrl('images/col-right-2.gif')?>" alt="Shipping & returns">
	</a>
</section>
<?php if($this->getLayout()->getBlock('free.delivery')):?>
<div class="div-none" style="height: 275px; float: left; width: 100%;"></div>
<?php endif?>
<script type="text/javascript">
	BundleSummary = { 
		initialize: function () {
			this.summary = $('sidebar');
			this.summaryOffsetTop = 0;
			this.summary.setStyle({top:this.summaryOffsetTop + "px"});
			this.summaryContainer = this.summary.up(0);
			this.doNotCheck = false;
			this.summaryStartY = this.summary.positionedOffset().top;
			this.summaryStartY = this.summaryOffsetTop;
			this.summaryStartX = this.summary.positionedOffset().left;
			this.onDocScroll = this.handleDocScroll.bindAsEventListener(this);
			this.GetScroll = setInterval(this.onDocScroll, 50);
			this.onEffectEnds = this.effectEnds.bind(this);
		},

		handleDocScroll: function () {
			if (this.currentOffsetTop == document.viewport.getScrollOffsets().top
				&& (this.checkOffset(null) == null)) {
				return;
			} else {
				if (this.currentOffsetTop == document.viewport.getScrollOffsets().top) {
					this.doNotCheck = true;
				}
				this.currentOffsetTop = document.viewport.getScrollOffsets().top;
			}

			if (this.currentEffect) {
				this.currentEffect.cancel();
				var topOffset = 0;
				if (this.summaryContainer.viewportOffset().top < -60) {
				   topOffset =  -(this.summaryContainer.viewportOffset().top) + 15; //add leading space from cart to top edge
				} else {
				   topOffset = this.summaryStartY;
				}
				
				topOffset = this.checkOffset(topOffset);
				if (topOffset === null) {
					this.currentEffect = false;
					return;
				}
				
				this.currentEffect.start({
					x: this.summaryStartX,
					y: topOffset,
					mode: 'absolute',
					duration: 0.3,
					afterFinish: this.onEffectEnds
				});					
				return;
			}				
			this.currentEffect = new Effect.Move(this.summary);
		},
		
		effectEnds: function () {
			if (this.doNotCheck == true) {
				this.doNotCheck = false;
			}
		},
		
		checkOffset: function (offset) {
			if (this.doNotCheck && offset === null) {
				return null;
			}
			var dimensions = this.summary.getDimensions();
			var parentDimensions = this.summary.up().getDimensions();
			if ((offset !== null ? offset : this.summary.offsetTop) + dimensions.height >= parentDimensions.height) {
				offset = parentDimensions.height - dimensions.height;
			} else if (offset === null &&
				this.currentOffsetTop > (this.summaryContainer.viewportOffset().top) &&
				(this.currentOffsetTop - this.summaryContainer.viewportOffset().top) > this.summary.offsetTop) {
				offset = this.currentOffsetTop - this.summaryContainer.viewportOffset().top;
			}
			
			
			return offset >= 0 ? offset : 0;
		},

		exitSummary: function () {
			clearInterval(this.GetScroll);
		}
	};
	
	//load later from dom loaded
	jQuery(window).load(function(){
		checkScroll();
		
		jQuery('#sidebar').bind('resize', function(){
			checkScroll();
		});		
		
		jQuery('.col-main').bind('resize', function(){
			checkScroll();
		});
		
		function checkScroll(){
			var sidebarHeight = jQuery('#sidebar').outerHeight();
			var mainHeigh = jQuery('.col-main').outerHeight();
			
			if(mainHeigh < sidebarHeight){			
				jQuery('.free-delivery').css({
					position: 'absolute',
					bottom: 0,
					left: 0
				});
			}
			
			jQuery('.col-main').css({
				minHeight: (jQuery('#sidebar').outerHeight() - (jQuery('.free-delivery').length == 1 ? 275 : 0)) + 'px',
				position: 'relative',
				paddingBottom: ((jQuery('.free-delivery').length == 1 && jQuery('.free-delivery').css('position') == 'absolute') ? 306 : 0) + 'px'
			});		
		}
		
		BundleSummary.initialize();
	});
</script>